﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
{-include file="`$__PHY_WEB``$__DIR_ADM`/block/meta.tpl"-}
<title>下属管理 - 后台</title>
</head>

<body>
<div class="sAll">

{-include file="`$__PHY_WEB``$__DIR_ADM`/block/header.tpl"-}
{-php-}include(__PHY_WEB.__DIR_ADM."/block/menu.php");{-/php-}
{-include file="`$__PHY_WEB``$__DIR_ADM`/block/menu.tpl" uL=$rNav-}

<div class="sL">
	<div class="sW main">
<!-- <main> -->
{- if $sMsg -}{- include file="`$__PHY_WEB``$__DIR_ADM`/block/message.tpl" -}{- /if -}

{- if 'list'==$sAction -}
<div class="sL list">
	<p>你的下属列表</p>
	<table>
		<tr class="caption">
			<td>账号</td>
			<td>名字</td>
			<td>开放下属</td>
			<td><a href="?action=new">新建</a></td>
		</tr>
{-section name=i loop=$rUsers-}
		<tr>
			<td>{-$rUsers[i].user_ename|escape:html-}</td>
			<td>{-$rUsers[i].user_cname|escape:html-}</td>
			<td>{-if $rUsers[i].grantable-}开放{-else-}关闭{-/if-}</td>
			<td><a href="?action=edit&id={-$rUsers[i].id-}">修改</a></td>
		</tr>
{-/section-}
		<tr class="caption">
			<td>账号</td>
			<td>名字</td>
			<td>开放下属</td>
			<td><a href="?action=new">新建</a></td>
		</tr>
	</table>
</div>
{- elseif 'edit'==$sAction -}
<div class="sL edit"><div class="sL" style="width:210px;">
	<p>修改信息</p>
	<table>
		<form method="post" action="?">
		<input type="hidden" name="id" value="{-$rUser.id|escape:html-}" />
		<tr>
			<td align="right">账号：</td>
			<td>{-$rUser.user_ename|escape:html-}</td>
		</tr>
		<tr>
			<td align="right">名字：</td>
			<td>{-$rUser.user_cname|escape:html-}</td>
		</tr>
		<tr>
			<td align="right">下属管理：</td>
			<td>
				<input type="radio" name="grantable" value="0"{-if 0==$rUser.grantable-} checked="checked"{-/if-}>关闭
				<input type="radio" name="grantable" value="1"{-if 1==$rUser.grantable-} checked="checked"{-/if-}>开放
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="submit" name="action" value="update" />
				<input type="submit" name="action" value="cancel" />
			</td>
		</tr>
		</form>
	</table>
</div><div class="sL" style="width:210px;">
	<p>将此人交给其他人管理</p>
	<table>
		<form method="post" action="?">
		<input type="hidden" name="id" value="{-$rUser.id|escape:html-}" />
		<tr>
			<td colspan="2" align="center">
				<select name="grantto">
					<option value="0">== 选择 ==</option>
					<option value="{-$rUpUser.id-}">↑{-$rUpUser.user_ename-}:{-$rUpUser.user_cname|escape:html-}</option>
{-section name=i loop=$rGtUser-}
					<option value="{-$rGtUser[i].id-}">＼{-$rGtUser[i].user_ename-}:{-$rGtUser[i].user_cname|escape:html-}</option>
{-/section-}
				</select>
				<input type="submit" name="action" value="grant" />
			</td>
		</tr>
		</form>
	</table>
</div></div>
{- elseif 'new'==$sAction -}
<div class="sL edit">
	<p>新建下属帐户</p>
	<table>
		<form method="post" action="?">
		<tr>
			<td align="right">账号：</td>
			<td><input type="text" name="user_ename" /></td>
		</tr>
		<tr>
			<td align="right">名字：</td>
			<td><input type="text" name="user_cname" /></td>
		</tr>
		<tr>
			<td align="right">初始密码：</td>
			<td><input type="password" name="new_pswd" /></td>
		</tr>
		<tr>
			<td align="right">重复密码：</td>
			<td><input type="password" name="rep_pswd" /></td>
		</tr>
		<tr>
			<td align="right">下属管理：</td>
			<td>
				<input type="radio" name="grantable" value="0" checked="checked">关闭
				<input type="radio" name="grantable" value="1">开放
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="submit" name="action" value="add" />
				<input type="submit" name="action" value="cancel" />
			</td>
		</tr>
		</form>
	</table>
</div>
{- else -}
sth wrong: no $sAction.
{- /if -}

<!-- </main> -->
	</div>
</div>

{- include file="`$__PHY_WEB``$__DIR_ADM`/block/footer.tpl" -}

</div><!-- end all -->
</body>
</html>
